$(function() {
	
	// Contact Form Variables
	var $name = $("input#name");
	var $phone = $("input#phone");
	var $email = $("input#email");
	var $subject = $("input#subject");
		
	// Actions on Focus
	$name.focus(function() { if( $name.val() == 'სახელი, გვარი' ) { $name.val(''); } });
	$phone.focus(function() { if( $phone.val() == 'ტელეფონი' ) { $phone.val(''); } });
	$email.focus(function() { if( $email.val() == 'ელფოსტა' ) { $email.val(''); } });
	$subject.focus(function() { if( $subject.val() == 'თემა' ) { $subject.val(''); } });
	
	// Actions on Blur
	$('input').blur(function() {		
		if( $name.val() == '' ) { $name.val('სახელი, გვარი'); }
		if( $phone.val() == '' ) { $phone.val('ტელეფონი'); }
		if( $email.val() == '' ) { $email.val('ელფოსტა'); }
		if( $subject.val() == '' ) { $subject.val('თემა'); }
	});
	
	
	// Custom Checkbox
	if( $('.custom-checkbox').length )
	{
		$('.custom-checkbox').checkbox({
			empty: 'media/images/empty.png'  
		});
	}
	
	
	//  Custom Select Box
	if( $("select.custom-select").length > 0 )
	{
		$("select.custom-select").msDropDown();		
		$(".ddChild a:last-child").addClass('ddLastChild');
	}
	
	
	/* Map Button */
	$(".open").click(function(e) {	
		
		var open = $(".open"), 
			mapContainer = $("div#map-container"),
			contactForm = $("div#contact-form");							
		
		contactForm.hide();
		mapContainer.animate({
			'width' : '808px',
			'float' : 'left'
		}, function(){
			open.removeClass('open').addClass('close');
		});
				
		
		e.preventDefault();
	});
	
	
	$("body").on('click', 'a.close', function(e) {
		
		var close = $(".close"), 
			mapContainer = $("div#map-container"),
			contactForm = $("div#contact-form");		
		
		mapContainer.animate({
			'width' : '397px',
			'float' : 'right'
		}, function() {
			contactForm.fadeIn(function() {
				close.removeClass('close').addClass('open');
			});
		});
		
		e.preventDefault();
	});
	
	
});
